package com.jcl.cloud.services.crawler.brain.controller;


import com.jcl.cloud.services.crawler.brain.service.ManageTaskService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(
        value = {"/crawler-brain/api/v1"},
        produces = {"application/json"}
)
public class TaskController {


   private final static Logger logger = LoggerFactory.getLogger(TaskController.class);


   @Autowired
   private ManageTaskService manageTaskService;

    @RequestMapping(
            value = {"/task/report"},
            method = {RequestMethod.GET}
    )
    public void reportCookieFail(String crawlerId){

        try {
            logger.info("上报cookie失效的任务号为crawlerId = " + crawlerId);

            this.manageTaskService.manageCookieFail(crawlerId);
        } catch (Exception e) {
            e.printStackTrace();
        }


    }
}
